package com.ruoyi.zyx.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.zyx.mapper.ZyxTakecareMapper;
import com.ruoyi.zyx.domain.ZyxTakecare;
import com.ruoyi.zyx.service.IZyxTakecareService;

/**
 * 保养信息Service业务层处理
 *
 * @author lhs
 * @date 2021-06-01
 */
@Service
public class ZyxTakecareServiceImpl implements IZyxTakecareService
{
    @Autowired
    private ZyxTakecareMapper zyxTakecareMapper;

    /**
     * 查询保养信息
     *
     * @param id 保养信息ID
     * @return 保养信息
     */
    @Override
    public ZyxTakecare selectZyxTakecareById(Long id)
    {
        return zyxTakecareMapper.selectZyxTakecareById(id);
    }

    @Override
    public ZyxTakecare getByDeviceId(Long deviceid) {
        return zyxTakecareMapper.getByDeviceId( deviceid);
    }

    /**
     * 查询保养信息列表
     *
     * @param zyxTakecare 保养信息
     * @return 保养信息
     */
    @Override
//    @DataScope(deptAlias = "d", userAlias = "")
    public List<ZyxTakecare> selectZyxTakecareList(ZyxTakecare zyxTakecare)
    {
        return zyxTakecareMapper.selectZyxTakecareList(zyxTakecare);
    }

    @Override
    public List<ZyxTakecare> listMyTakecare(ZyxTakecare zyxTakecare) {
        return zyxTakecareMapper.selectZyxTakecareList(zyxTakecare);
    }

    /**
     * 新增保养信息
     *
     * @param zyxTakecare 保养信息
     * @return 结果
     */
    @Override
    public int insertZyxTakecare(ZyxTakecare zyxTakecare)
    {
        zyxTakecare.setCreateTime(DateUtils.getNowDate());
        return zyxTakecareMapper.insertZyxTakecare(zyxTakecare);
    }

    /**
     * 修改保养信息
     *
     * @param zyxTakecare 保养信息
     * @return 结果
     */
    @Override
    public int updateZyxTakecare(ZyxTakecare zyxTakecare)
    {
        zyxTakecare.setUpdateTime(DateUtils.getNowDate());
        return zyxTakecareMapper.updateZyxTakecare(zyxTakecare);
    }

    /**
     * 批量删除保养信息
     *
     * @param ids 需要删除的保养信息ID
     * @return 结果
     */
    @Override
    public int deleteZyxTakecareByIds(Long[] ids)
    {
        return zyxTakecareMapper.deleteZyxTakecareByIds(ids);
    }

    /**
     * 删除保养信息信息
     *
     * @param id 保养信息ID
     * @return 结果
     */
    @Override
    public int deleteZyxTakecareById(Long id)
    {
        return zyxTakecareMapper.deleteZyxTakecareById(id);
    }

    @Override
    public int delByDeviceId(Long id) {
        return zyxTakecareMapper.delByDeviceId(id);
    }
}
